package com.yiren.manager.service.impl.pension;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yiren.core.exception.MyException;
import com.yiren.core.service.GenericServiceImpl;
import com.yiren.core.utils.Favorites;
import com.yiren.entity.YrBaseServiceCost;
import com.yiren.entity.YrBaseServiceCostHistory;
import com.yiren.manager.repository.pension.YrBaseServiceCostHistoryRepository;
import com.yiren.manager.repository.pension.YrBaseServiceCostRepository;
import com.yiren.manager.service.iface.pension.YrBaseServiceCostService;

@Service("yrBaseServiceCostService")
public class YrBaseServiceCostServiceImpl extends GenericServiceImpl<YrBaseServiceCost, String> implements YrBaseServiceCostService{
	
	@Autowired
	private YrBaseServiceCostHistoryRepository  yrBaseServiceCostHistoryRepository;
	
	@Autowired
	public YrBaseServiceCostServiceImpl(YrBaseServiceCostRepository repository) {
		super(repository);
	}

	@Transactional
	public void addByFavorites(Favorites entitys) throws MyException {
		YrBaseServiceCost baseServiceCost = entitys.getFavorite(YrBaseServiceCost.class);
		YrBaseServiceCostHistory yrBaseServiceCostHistory = entitys.getFavorite(YrBaseServiceCostHistory.class);
		
		this.repository.save(baseServiceCost);
		yrBaseServiceCostHistoryRepository.save(yrBaseServiceCostHistory);
	}

	@Transactional
	public void modifyByFavorites(Favorites entitys) throws MyException {
		// TODO Auto-generated method stub
		
	}

}
